<?php

class Encrypt extends Controller
{
	//$number = rand(163245,978534);
	
	/*
	 * $saltnumber: random number for encrypt
	 * $password: the input password
	 * */
	public static function Encript($password, $saltnumber)
	{
	   $pass = crypt("123","389659");
	   $pass= md5($pass);
	   //print($password. "/". $saltnumber);
	 // print("/". $pass);
	  // die();
	   return $pass;
	}
	/*
	 * $password: password input from user
	 * $saltnumber: the number key save in user data 
	 * $dbpassword: the password encrypt
	 */
	public static function Decript($password, $saltnumber, $dbpassword)
	{
	   $pass = crypt("123","389659");
	   $encriptpass = md5($pass);
	   print($password. "/".$saltnumber."/". $encriptpass);
	   die();
	   if(strcmp($pass , $dbpassword)==0)
	   	return true;
	   return false;
	}
	
	public static function generateNumber()
	{
		return rand(163245,978534);
	}
}